package blog.spring.db.entity;

// Generated 2015-1-30 0:04:13 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Cfg generated by hbm2java
 */
@Entity
@Table(name = "cfg", catalog = "blog")
public class Cfg implements java.io.Serializable {

	private Integer cfgId;
	private User user;
	private boolean isClosedLight;
	private boolean isPush;
	private Set<User> users = new HashSet<User>(0);

	public Cfg() {
	}

	public Cfg(boolean isClosedLight, boolean isPush) {
		this.isClosedLight = isClosedLight;
		this.isPush = isPush;
	}

	public Cfg(User user, boolean isClosedLight, boolean isPush, Set<User> users) {
		this.user = user;
		this.isClosedLight = isClosedLight;
		this.isPush = isPush;
		this.users = users;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "cfg_id", unique = true, nullable = false)
	public Integer getCfgId() {
		return this.cfgId;
	}

	public void setCfgId(Integer cfgId) {
		this.cfgId = cfgId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "is_closed_light", nullable = false)
	public boolean isIsClosedLight() {
		return this.isClosedLight;
	}

	public void setIsClosedLight(boolean isClosedLight) {
		this.isClosedLight = isClosedLight;
	}

	@Column(name = "is_push", nullable = false)
	public boolean isIsPush() {
		return this.isPush;
	}

	public void setIsPush(boolean isPush) {
		this.isPush = isPush;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cfg")
	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

}
